/***************************************************************************\
 * The Mattise Kernel														*
 * Copyright 2007 Matthew Iselin											*
 * Licensed under the GPL													*
 *																			*
 * reloc.h																	*
 *																			*
 * Relocation superclass, all relocations need to be done in terms of this	*
 * class																	*
 *																			*
\***************************************************************************/

// Pragmas
#pragma once

// Includes
#include <system.h>
#include <stdio.h>

// Class Definition

class Relocation {
	public:
	
		// constructor
		Relocation();
		
		// destructor
		~Relocation();
		
		// gets the address of the executable
		uint_t GetBase();
		
		// loads the file
		bool LoadFile( const char* fn );
		
		/// Loads from a position in memory (ie. already loaded the data)
		bool LoadFile( const int addr );
		
	private:
	
		// buffer for our file data
		char* fileData;
		
	protected:
		
		// filename we're working with
		char* fileName;
		
		// file handle
		int fp;
	
		// relocates the executable
		virtual bool RelocateExecutable() = 0;
		
};
